<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>Main</title>

		<link href="../css/themes/base/easyui.css" rel="stylesheet" />

		<!-- 以下3个CSS文件需要动态加载 -->
		<!-- <link href="../css/themes/skin-coolblack.css" rel="stylesheet" /> -->
		<!-- <link href="../css/site.css" rel="stylesheet" /> -->
		<!-- <link href="../css/fontawesome/css/font-awesome.min.css" rel="stylesheet" /> -->

		<style type="text/css">
			.over {
				top: 0;
				left: 0;
				z-index: 9999999;
				width: 100%;
				height: 100%;
				background-color: #f5f5f5;
				opacity: .5
			}

			.layout,
			.over {
				position: absolute;
				display: none
			}

			.layout {
				top: 40%;
				left: 40%;
				z-index: 100000000;
				width: 20%;
				height: 20%;
				text-align: center
			}

			body {
				font-size: 13px;
				font-family: 'Microsoft YaHei' !important
			}

			h1,
			h2,
			h3,
			h4,
			h5,
			h6,
			.h1,
			.h2,
			.h3,
			.h4,
			.h5,
			.h6 {
				font-family: 'Microsoft YaHei' !important
			}

			.box-body {
				min-height: 190px;
			}

			.box-header>.fa,
			.box-header>.glyphicon,
			.box-header>.ion,
			.box-header .box-title {
				font-size: 14px;
			}

			.label {
				line-height: 2px;
				padding: 1px;
			}

			#notePartContent h2 {
				font-size: 14px;
			}
		</style>

		<script src="../js/utils/jquery.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/utils/jquery.form.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/easyui/jquery.easyui.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/easyui/jquery.easyui.plus.js" charset="utf-8"></script>
		<script src="../js/easyui/easyui-lang-zh-CN.js" type="text/javascript"></script>
		<script src="../js/utils/common.js" type="text/javascript" charset="UTF-8"></script>
		<script src="../js/utils/baseUrl.js"></script>

		<script type="text/javascript" charset="UTF-8">
			$(function() {
				//获取主题
				var theme = window.localStorage.getItem("theme");
				console.log("主题：" + theme)
				if (!theme) {
					theme = "coolblack";
				}
				//动态加载主题
				dynamicLoadCss('../css/themes/skin-' + theme + '.css');
				//由于以下两个CSS引用需要在主题之后，因此也必须动态引用进来
				dynamicLoadCss('../css/site.css');
				dynamicLoadCss('../css/fontawesome/css/font-awesome.min.css');
			});
		</script>
	</head>
	<body>
		<div style="padding:4px 5px 0px 5px;">
			<link href="../css/fullcalendar/fullcalendar.css" rel="stylesheet" />
			<link href="../css/bootstrap.min.css" rel="stylesheet" />
			<link href="../css/AdminLTE/AdminLTE.min.css" rel="stylesheet" />

			<script src="../js/utils/echarts.min.js"></script>
			<script src="../js/utils/echarts.theme.shine.js"></script>
			<script src="../js/fullcalendar/moment.min.js"></script>
			<script src="../js/fullcalendar/fullcalendar.min.js"></script>
			<script src="../js/fullcalendar/zh-cn.js"></script>
			<script>
				$(function() {
					//通知公告
					Load_NoticePart();
					//我的批阅
					Load_MyJobPart();
					//数据统计
					Load_DataPart();
					//日程管理
					Load_NotePart();
				});
				//加载通知公告
				function Load_NoticePart() {
					http.ajax("post", "/" + _YMGlobal.Config.currentCulture + "/Home/GetPartDataByNotice", {}, function(data) {
						var sb = "";
						for (var i = 0; i < data.rows.length; i++) {
							sb = sb + "<div class='exceed'><a style='float:left;' class=\"color-black\" href=\"javascript:ShowInfo('" +
								data.rows[i].Title + "','" + data.rows[i].Id + "')\"><p>[" + data.rows[i].CategoryName + "]&nbsp;" + data.rows[
									i].Title + "</p></a><div style='float:right;width:100px;'><p>[" + SubStrYMD(data.rows[i].CreateTime) +
								"]</p></div></div>";
						}
						$("#noticePartContent").html(sb);
					});
				}
				//加载我的批阅
				function Load_MyJobPart() {
					http.ajax("post", "/" + _YMGlobal.Config.currentCulture + "/Home/GetPartDataByMyJob", {}, function(data) {
						var str = "";
						for (var i = 0; i < data.rows.length; i++) {
							str = str + "<div class='exceed'><a style='float:left;' href='javascript:ManageFlow(\"" + data.rows[i].Title +
								"\",\"" + data.rows[i].FormId + "\",\"" + data.rows[i].Id + "\");' class=\"color-black\">" + getFlowLevel(
									data.rows[i].FormLevel) + "&nbsp;" + data.rows[i].UserName + "-&nbsp;" + data.rows[i].Title + "-处理状态：" +
								getCurrentState(data.rows[i].CurrentState) + "</a><div style='float:right;width:100px;'><p>[" + SubStrYMD(
									data.rows[i].CreateTime) + "]</p></div></div>";
						}
						$("#myJobPartContent").html(str);
					});

				}
				//加载数据统计
				function Load_DataPart() {
					var option = {
						tooltip: {
							trigger: 'item',
							formatter: "{a} <br />{b}: {c} ({d}%)"
						},
						legend: {
							orient: 'vertical',
							x: 'left',
							data: ['EasyUI', 'Asp.Net Mvc', 'Html+Css', 'JavaScript']
						},
						series: [{
							name: '比重',
							type: 'pie',
							selectedMode: 'single',
							radius: [0, '30%'],
							label: {
								normal: {
									position: 'inner'
								}
							},
							labelLine: {
								normal: {
									show: false
								}
							},
							data: [{
								value: 560,
								name: 'JS'
							}, {
								value: 330,
								name: 'Html'
							}, {
								value: 308,
								name: 'Css'
							}, {
								value: 448,
								name: 'C#',
								selected: true
							}]
						}, {
							name: '比重',
							type: 'pie',
							radius: ['40%', '55%'],
							data: [{
								value: 535,
								name: 'EasyUI'
							}, {
								value: 250,
								name: 'JavaScript'
							}, {
								value: 100,
								name: 'Html+Css'
							}, {
								value: 205,
								name: 'Asp.Net Mvc'
							}]
						}]
					};

					$("#dataPartContent").attr("style", "border:0px;height:250px;");
					var myChart = echarts.init(document.getElementById('dataPartContent'), "shine");
					myChart.setOption(option);
				}
				//加载日程管理
				function Load_NotePart() {
					$('#calendar').fullCalendar({
						weekNumbers: true,
						weekNumbersWithinDays: true,
						weekNumberCalculation: 'ISO',
						editable: true,
						navLinks: true, // can click day/week names to navigate views
						defaultView: 'listWeek',
						contentHeight: 165,
						selectable: true,
						selectHelper: true, //在agenda视图下选择时会带上对应的时间
						dragOpacity: 0.5, //Event被拖动时的不透明度
						droppable: true, // this allows things to be dropped onto the calendar
						drop: function() {
							// is the "remove after drop" checkbox checked?

						},
						eventLimit: true, // allow "more" link when too many events
						events: {
							url: baseUrl + '/SysCalendarPlan/GetList',
							error: function() {
								$.messageBox5s(Lang.Tip, "请求错误");
							}
						}, //点击
						windowResize: function(view) {

						}
					});


				}
				//格式化流程级别
				function getFlowLevel(value) {
					if (value == 1) {
						return "<span class='label label-success'>普通</span>";
					}
					if (value == 2) {
						return "<span class='label label-info'>重要</span>";
					}
					if (value == 3) {
						return "<span class='label label-error'>紧急</span>";
					}
					return "";
				}
				//格式化批阅状态
				function getCurrentState(value) {
					var _pass = "<span class='label label-success'>已结束</span>";
					var _progress = "<span class='label label-info'>进行中</span>";
					var _reject = "<span class='label label-error'>已驳回</span>";
					var _close = "<span class='label label-error'>已超时</span>";
					if (value == 1) {
						return _pass;
					}
					if (value == 2) {
						return _progress;
					}
					if (value == 0) {
						return _reject;
					}
					return _close;
				}
				//打开文章
				function ShowInfo(name, url) {
					console.log("点击并打开文章【" + name + "】");
					console.log("name：" + name, "url：" + url);
					alert("点击并打开文章【" + name + "】");
				}
				//打开工作流
				function ManageFlow(winTitle, formId, id) {
					console.log("点击并打开工作流【" + winTitle + "】");
					console.log("winTitle：" + winTitle, "formId：" + formId, "id：" + id);
					alert("点击并打开工作流【" + winTitle + "】");
				}
			</script>

			<div id="modalwindowContent" class="easyui-window" data-options="modal:true,closed:true,minimizable:false,shadow:false"></div>
			<div class="row" style="margin-top:10px;">
				<div class="col-md-3 col-sm-6 col-xs-12">
					<div class="info-box">
						<span class="info-box-icon bg-aqua"><i style="font-size:45px;" class="fa fa-envelope-o"></i></span>
						<div class="info-box-content">
							<span class="info-box-text">Messages</span>
							<span class="info-box-number">1,410</span>
						</div><!-- /.info-box-content -->
					</div><!-- /.info-box -->
				</div><!-- /.col -->
				<div class="col-md-3 col-sm-6 col-xs-12">
					<div class="info-box">
						<span class="info-box-icon bg-green"><i style="font-size:45px;" class="fa fa-flag-o"></i></span>
						<div class="info-box-content">
							<span class="info-box-text">Bookmarks</span>
							<span class="info-box-number">410</span>
						</div><!-- /.info-box-content -->
					</div><!-- /.info-box -->
				</div><!-- /.col -->
				<div class="col-md-3 col-sm-6 col-xs-12">
					<div class="info-box">
						<span class="info-box-icon bg-yellow"><i style="font-size:45px;" class="fa fa-files-o"></i></span>
						<div class="info-box-content">
							<span class="info-box-text">Uploads</span>
							<span class="info-box-number">13,648</span>
						</div><!-- /.info-box-content -->
					</div><!-- /.info-box -->
				</div><!-- /.col -->
				<div class="col-md-3 col-sm-6 col-xs-12">
					<div class="info-box">
						<span class="info-box-icon bg-red"><i style="font-size:45px;" class="fa fa-star-o"></i></span>
						<div class="info-box-content">
							<span class="info-box-text">Likes</span>
							<span class="info-box-number">93,139</span>
						</div><!-- /.info-box-content -->
					</div><!-- /.info-box -->
				</div><!-- /.col -->
			</div>
			<div class="row">
				<div class="col-sm-6">
					<div class="box box-default">
						<div class="box-header with-border">
							<h3 class="box-title"><i class="fa fa-bullhorn"></i>&nbsp;通知公告</h3>
						</div><!-- /.box-header -->
						<div class="box-body" id="noticePartContent">
							<div class="panel-loading">
								Loading...
							</div>
						</div><!-- /.box-body -->
					</div><!-- /.box -->
				</div><!-- /.col -->
				<div class="col-sm-6">
					<div class="box box-default">
						<div class="box-header with-border">
							<h3 class="box-title"><i class="fa fa-file-text-o"></i>&nbsp;我的批阅</h3>

						</div><!-- /.box-header -->
						<div class="box-body" id="myJobPartContent">
							<div class="panel-loading">
								Loading...
							</div>
						</div><!-- /.box-body -->
					</div><!-- /.box -->
				</div><!-- /.col -->
				<div class="col-sm-6">
					<div class="box box-default">
						<div class="box-header with-border">
							<h3 class="box-title"><i class="fa fa-bar-chart"></i>&nbsp;数据统计</h3>

						</div><!-- /.box-header -->
						<div class="box-body" id="dataPartContent">
							<div class="panel-loading">
								Loading...
							</div>
						</div><!-- /.box-body -->
					</div><!-- /.box -->
				</div><!-- /.col -->
				<div class="col-sm-6">
					<div class="box box-default">
						<div class="box-header with-border">
							<h3 class="box-title"><i class="fa fa-calendar"></i>&nbsp;日程管理</h3>

						</div><!-- /.box-header -->
						<div class="box-body" id="notePartContent">
							<div id="calendar"></div>

						</div><!-- /.box-body -->
					</div><!-- /.box -->
				</div><!-- /.col -->
			</div>
		</div>
		<div id="over" class="over"></div>
		<div id="layout" class="layout"><img src="../img/loading.gif" /></div>
		<div id="fullSetContent"></div>
		<script type="text/javascript">
			$(function() {
				if (isExitsFunction(window.parent.fullSetButtonOut)) {
					$("#fullSetContent").html(window.parent.fullSetButtonOut());
					$("#fullSetButton").click(function() {
						if ($(this).attr("class") == "fa fa-expand") {
							$(this).removeClass("fa-expand").addClass("fa-compress");
						} else {
							$(this).removeClass("fa-compress").addClass("fa-expand");
						}
						window.parent.fullSet();
					});
				}
			});
		</script>
	</body>
</html>
